package com.sjb.cp.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.sjb.cp.model.po.User;
import com.sjb.cp.model.request.user.UserQueryRequest;
import com.sjb.cp.model.vo.UserLoginVo;
import com.sjb.cp.model.vo.UserVo;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* @author dell
* @description 针对表【user(用户)】的数据库操作Service
* @createDate 2024-12-10 09:14:48
*/
public interface UserService extends IService<User> {

    /**
     * 用户注册
     * @param userAccount
     * @param userPassword
     * @param checkPassword
     * @return
     */
    long userRegister(String userAccount,String userPassword,String checkPassword,String userType);


    /**
     * 用户登录
     * @param userAccount
     * @param userPassword
     * @param request
     * @return
     */
    UserLoginVo userLogin(String userAccount, String userPassword, HttpServletRequest request);

    /**
     * 密码加密
     * @param userPassword
     * @return
     */
    String getEncryptPassword(String userPassword);

    /**
     * 获取当前登录用户信息
     * @param request
     * @return
     */
    User getLoginUser(HttpServletRequest request);


    UserLoginVo getLoginUserVo(User user);

    /**
     * 注销登录
     * @param request
     * @return
     */
    boolean logOut(HttpServletRequest request);

    /**
     * 获取单个用户信息
     * @param user
     * @return
     */
    UserVo getUserVo(User user);

    /**
     * 批量获取用户信息
     * @param users
     * @return
     */
    List<UserVo> getUserVoList(List<User> users);

    QueryWrapper<User> getQueryWrapper(UserQueryRequest userQueryRequest);

    /**
     * 是否为管理员
     * @param user
     * @return
     */
    boolean isAdmin(User user);

}
